
import request from '@/utils/request'

/**
 * 获取部门列表
 * @returns
 */
export const getDeptListAPI = () => {
  return request({
    method: 'get',
    url: '/company/department'
  })
}

/**
 * 删除部门
 * @returns
 */
export const delDeptAPI = (deptId) => {
  return request({
    method: 'delete',
    url: `/company/department/${deptId}`
  })
}

/**
 * 获取部门负责人列表
 */
export const getManagerListAPI = () => {
  return request({
    method: 'get',
    url: '/sys/user/simple'
  })
}

/**
 * 新增部门
 * @param {*} deptForm
 * @returns
 */
export const postDeptAPI = (deptForm) => {
  return request({
    method: 'post',
    url: '/company/department',
    data: deptForm
  })
}

/**
 * 根据部门 ID 获取部门详情
 */
export const getDeptDetailAPI = (deptID) => {
  return request({
    method: 'get',
    url: `/company/department/${deptID}`
  })
}

/**
 * 修改部门
 * @param {*} deptForm
 * @returns
 */
export const putDeptAPI = (deptForm) => {
  return request({
    method: 'put',
    url: `/company/department/${deptForm.id}`,
    data: deptForm
  })
}
